home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
mxlibs
/
dwstk102
/
findsb.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-04-12
|
4KB
|
154 lines
(******************************************************************************
File: findsb.pas 1.02
Tab stops: every 2 columns
Project: FINDSB utility
Copyright: 1994-1995 DiamondWare, Ltd. All rights reserved.
Written: Keith Weiner & Erik Lorenzen
Pascal Conversion: David A. Johndrow
Purpose: Example code to autodetect and print out the sound hardware
History: 94/10/21 KW Started
94/11/11 DJ Converted
95/02/02 EL Cleaned up & Finalized
95/03/22 EL Finalized for 1.01
95/04/11 EL Finalized for 1.02
******************************************************************************)
Program FindSb;
uses crt, err, dws;
Var
dov: dws_DOPTR;
dres: dws_DRPTR;
Function HVal(i: word): char;
begin
if (i < 10) then
begin
HVal := chr(i+48);
end
else
begin
HVal := chr(i+55);
end;
end;
Function HexStr(d: word): string;
Var
s: string;
begin
s := ' ';
s[4] := HVal(d mod 16);
s[3] := HVal((d div 16) mod 16);
s[2] := HVal((d div 256) mod 16);
s[1] := HVal((d div 4096) mod 16);
while (s[1] = '0') and (length(s) > 1) do
begin
Delete(s,1,1);
end;
HexStr := s;
end;
begin
writeln;
writeln('FINDSB 1.02 is Copyright 1994-95, DiamondWare, Ltd.');
writeln('All rights reserved.');
writeln;
writeln;
new(dov);
new(dres);
(*
. We need to set every field to -1 (65635) in dws_DETECTOVERRIDES struct;
. this tells the STK to autodetect everything. Any other value
. overrides the autodetect routine, and will be accepted on
. faith, though the STK will verify it if possible.
*)
dov^.baseport := 65535;
dov^.digdma := 65535;
dov^.digirq := 65535;
if (dws_DetectHardWare(dov, dres) = 0) then
begin
err_Display;
halt(65535);
end;
if (((dres^.capability and dws_capability_FM) = dws_capability_FM) or
((dres^.baseport <> 904) and (dres^.baseport <> 65535))) then
begin
writeln('Base port is ',HexStr(dres^.baseport),' hex');
writeln('');
if (dres^.mixtyp <> 1) then
begin
writeln('The sound hardware supports mixing.');
writeln('');
end
else
begin
writeln('Mixing will be done in software.');
writeln('');
end;
if ((dres^.capability and dws_capability_FM) = dws_capability_FM) then
begin
writeln('The sound hardware supports FM music playback.');
writeln;
end
else
begin
writeln('Support for FM music playback not found.');
writeln('');
end;
if ((dres^.capability and dws_capability_DIG) = dws_capability_DIG) then
begin
(* If we got here dws_DetectHardWare got PORT, IRQ, & DMA *)
writeln('The sound hardware supports digitized sound playback.');
writeln('The sound hardware uses DMA channel ',dres^.digdma,' and IRQ level ',dres^.digirq,'.');
writeln;
end
else if ((dres^.baseport <> 904) and (dres^.baseport <> 65535)) then
begin
(*
. If dres.baseport isn't either 388hex, or -1, then it's a valid
. baseport. So if we got here, then we didn't find either IRQ
. level, and/or DMA channel. In order to play digitized sounds,
. we need these settings as well. In your application, you should
. ask the user.
*)
writeln('The sound hardware supports digitized sound playback,');
writeln('but we could not find the DMA channel and/or IRQ level.');
end
else
begin
writeln('Support for digitized playback not found.');
writeln('');
end;
end
else
begin
writeln('No sound hardware detected.');
writeln;
end;
end.